$(function () {
   obj.init();
});
var obj = new function () {
    'use strict';
    return {
        form:null,
        init:function () {
            this.listener();
        },
        listener:function () {
            var $this = this;
            //展开学校详细列表
            $('#open_close').click(function () {
                var open_icon = $('#open_icon');
                if (open_icon.hasClass('fa fa-chevron-up')){
                    open_icon.removeClass('fa fa-chevron-up').addClass('fa fa-chevron-down');
                    $('#teaAndSchool').find('[class^="schoolDetail"]').each(function () {
                        this.style.display = 'none';
                    });
                } else {
                    open_icon.removeClass('fa fa-chevron-down').addClass('fa fa-chevron-up');
                    $('#teaAndSchool').find('[class^="schoolDetail"]').each(function () {
                        this.style.display = 'table';
                    });
                }
            });
            //点击科目
            $('.grade').click(function () {
                $this.funObj().openGradeDetail($(this).attr("id"));
            });
        },
        funObj:function () {
            var $this = this;
            return {
                openGradeDetail:function (id) {
                    if (id === ''){
                        window.top.swal(error, msg, 'info');
                        console.log('老师书类型年级组合id不存在或不是同步书');
                        return false;
                    }
                    window.top.xhTop.showModal({
                        id: 'showGradeBookDetail',
                        title: '书本情况：',
                        content: xhTool.getFrameString('res/getBookByGrade', {id:id}, 500),
                        size: 'md',
                        backClose: true
                    });
                }
            }
        }
    }
};